package com.moli.iov.base.enums;

/**
 * The enum Param unit enum.
 *
 * @author wanghualin
 * @date 2019 -10-10 14:01:55
 */
public enum ParamUnitEnum {
  PERCENT("1", "%"),
  V("2", "V"),
  HOURS("3", "小时");

  private String code;

  private String cnName;

  private ParamUnitEnum(String code, String cnName) {
    this.code = code;
    this.cnName = cnName;
  }

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public String getCnName() {
    return cnName;
  }

  public void setCnName(String cnName) {
    this.cnName = cnName;
  }

  public static String getCodeName(String code) {
    for (ParamUnitEnum e : ParamUnitEnum.values()) {
      if (e.code.equals(code)) {
        return e.cnName;
      }
    }
    return null;
  }
}
